<template>
  <el-table :data="list" border>
    <el-table-column align="center" label="角色id">
      <template slot-scope="scope">
        {{ scope.row.id }}
      </template>
    </el-table-column>
    <el-table-column align="center" label="角色名称">
      <template slot-scope="scope">
        {{ scope.row.name }}
      </template>
    </el-table-column>
    <el-table-column align="center" label="默认">
      <template slot-scope="scope">
        {{ scope.row.isDefault ? '是' : '否' }}
      </template>
    </el-table-column>
    <!-- <el-table-column align="center" label="公开">
      <template slot-scope="scope">
        {{ scope.row.isPublic ? '是' : '否' }}
      </template>
    </el-table-column> -->
    <el-table-column align="center" width="250" label="操作">
      <template slot-scope="scope">
        <el-button
          v-permission="'AbpIdentity.Roles.Update'"
          type="text"
          size="medium"
          @click="handleEdit(scope)"
        >
          修改
        </el-button>
        <el-button
          v-permission="'AbpIdentity.Roles.ManagePermissions'"
          type="text"
          size="medium"
          @click="handlePermissions(scope)"
        >
          权限
        </el-button>
        <el-button
          v-permission="'AbpIdentity.Roles.Delete'"
          type="text"
          size="medium"
          @click="handleDelete(scope)"
        >
          删除
        </el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
import { parseDate2Str } from '@/utils/timeFormat'
export default {
  filters: {
    parseDate2Str: function (value) {
      return parseDate2Str(value)
    }
  },
  props: {
    list: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    handleEdit({ row }) {
      const vm = this
      vm.$emit('edit', row)
    },
    handlePermissions({ row }) {
      const vm = this
      vm.$emit('permissions', row)
    },
    handleDelete({ row }) {
      const vm = this
      vm.$emit('delete', row)
    }
  }
}
</script>

<style lang="scss" scoped></style>
